﻿using EachRecord.ViewModels;
using EachRecord.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EachRecord.Moudles
{
    /// <summary>
    /// 用户模块
    /// </summary>
    public class UserMoudle : IModule
    {
        private readonly IRegionViewRegistry _regionViewRegistry;
        public UserMoudle(IRegionViewRegistry    regionViewRegistry) { 
              _regionViewRegistry= regionViewRegistry;
        }
        /// <summary>
        /// 注册View
        /// </summary>
        /// <param name="containerProvider"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void OnInitialized(IContainerProvider containerProvider)
        {
            _regionViewRegistry.RegisterViewWithRegion("ContentRegion", typeof(UserInfo));
        }

        /// <summary>
        /// 绑定 ViewModel
        /// </summary>
        /// <param name="containerRegistry"></param>
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            ViewModelLocationProvider.Register<UserInfo, UserInfoViewModel>();
        }
    }
}
